function AutoInject(metadata: Array<string>): ClassDecorator {
	return (target: Function) => {
		const prototype = target.prototype;
		metadata.forEach((key) => {
			const prop = key;
			key = key.charAt(0).toUpperCase() + key.slice(1);
			prototype[`get${key}`] = function () {
				return this[prop];
			};
			prototype[`set${key}`] = function (value: string) {
				this[prop] = value;
			};
		});
		Object.seal(prototype);
	};
}

@AutoInject(['name', 'age'])
class AppModule {
	constructor(private name: string, private age: number) {}
}

interface AppModule {
	getAge(): number;
	getName(): string;
	setAge(age: number): void;
	setName(name: string): void;
}

const appModule = new AppModule('小明', 12);
console.log(appModule);
console.log(appModule.getAge());
console.log(appModule.getName());

appModule.setAge(13);
console.log(appModule.getAge());
